package com.cndcare.msc.netty.controller;

import com.cndcare.msc.netty.bean.DangerLogBean;
import com.cndcare.msc.netty.dao.jpa.DangerLogBeanJpa;
import com.cndcare.msc.netty.dao.jpa.PcBeanJpa;
import com.cndcare.msc.netty.service.DangerLogService;
import com.cndcare.msc.netty.vo.SearchVo;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.Map;

@Controller
@RequestMapping("/log")
public class DangerLogController {

    @Autowired
    private DangerLogService dangerLogService;
    @Autowired
    private PcBeanJpa pcBeanJpa;
    @Autowired
    private DangerLogBeanJpa dangerLogBeanJpa;

    @RequestMapping("/listDangerLog")
    public String listDangerLocalLog(Map<String, Object> map) {

        System.out.println(dangerLogBeanJpa);
        System.out.println(pcBeanJpa);

        map.put("statusDicMap", DangerLogBean.statusDicMap);

        return "log/danger_local_log_list";
    }

    @RequestMapping("/listDangerLogByParams")
    @ResponseBody
    public PageInfo<DangerLogBean> listDangerLogByParams(
            @RequestParam(value = "pn", defaultValue = "1") Integer pn,
            @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize,
            SearchVo searchVo
    ) {
        return dangerLogService.listDangerLogByParams(pn, pageSize, searchVo);
    }

}
